package com.example.tool.adapter;

import android.content.Context;
import android.graphics.Typeface;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.tool.R;
import com.example.tool.util.DebugLog;

import java.util.List;

/**
 * 描述:字体适配
 *
 * @author: liangkun
 * @date: 2019/10/22 10:46
 */
public class FontAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private List<String> data;
    private Context context;

    public FontAdapter(int layoutResId, @Nullable List<String> data,Context context) {
        super(layoutResId, data);
        this.data = data;
        this.context = context;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, String item) {
//        NumTextView numTextView=  helper.getView(R.id.tv_home_item);
        DebugLog.d(DebugLog.KUN + " item " + item);
        Typeface font = Typeface.createFromAsset(context.getAssets(), item);
        helper.setTypeface(R.id.tv_home_item, font);
    }
}
